namespace devtm.Aop.Emit
{
    using System;
    using devtm.Aop.Extensions;

    [Serializable]
    public class EmitPrimitiveExpression : EmitExpression
    {        

        public EmitPrimitiveExpression()
        {
        }

        public EmitPrimitiveExpression(object value)
        {

            this.Value = value;            

        }

        public object Value { get; set; }


        public override void Compile(CilWorker gen)
        {            

            if (Value is Int32)
            {
                gen.WriteInteger((Int32)Value);
            }
            else if (Value is string)
            {
                gen.WriteString((string)Value);
            }
            else
            {
                throw new NotImplementedException();
            }            

        }


    }
}
